package com.idea.zd.sys.train.io;


import java.io.FileReader;
import java.io.IOException;

public class FileReaderTest {

    /**
     * 输入字符流
     * @param args
     * @throws IOException
     */
    public static void main(String [] args) throws IOException{

        Read read = new Read();
        for (int i = 0; i <100 ; i++) {
            Thread thread = new Thread(read);
            thread.start();
        }
    }



}

class Read implements Runnable{

    @Override
    public void run() {
        try{
            FileReader fileReader = new FileReader("./src/main/java/com/idea/zd/sys/train/io/FileReaderTest.java");

            char [] chars = new char[32];

            int hasRead = 0;

            while((hasRead = fileReader.read(chars)) > 0){
                System.out.println(new String(chars,0,hasRead));
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
